package com.hhs.storage.bean;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hhs.storage.util.SysUtil;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * <p>
 *
 * </p>
 *
 * @author hhs
 * @since 2023-03-15
 */
@Data
public class CarLog implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * 车辆异常
     */
    public static final Integer car_error =1;
    /**
     * 车辆回收
     */
    public static final Integer car_back =2;
    /**
     * 车辆改变
     */
    public static final Integer car_change =3;

    private String id;

      /**
     * 车辆id
     */
      private String carId;
      @TableField(exist = false)
      private Car car;

      /**
     * 操作 1、车辆异常、2、车辆回收
     */
      private Integer operation;

      /**
     * 原因
     */
      private String reason;

      /**
     * 创建者
     */
      private String creator;

      /**
     * 创建时间
     */
      @JSONField(format = "yyyy-MM-dd HH:mm:ss")
      @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
      private LocalDateTime createTime;

    public String getOperationName() {
        return SysUtil.CAR_LOG_OPERATION_MAP.get(this.operation);
    }
}
